﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                assembly="KuaJing.Security"
				        namespace="KuaJing.Security.Domain">

  <class name="MembershipUser" table="Security_MembershipUser">
    <id name="Id" access="field.camelcase"
        column="MembershipUserId" type="Int32">
      <generator class="native" />
    </id>
    <version name="Version" access="field.camelcase" />
    <property name="Name" />
    <set name="Credentials"  cascade="all" inverse="false">
      <key column="MembershipUserId"></key>
      <one-to-many class="KuaJing.Security.Domain.MembershipUserCredential,KuaJing.Security" />
    </set>

    <set name="Roles" table="Security_MembershipUser_Role"  cascade="all" inverse="false">
      <key column="MembershipUserId"  foreign-key="fk_MembershipUser_Role"></key>
      <many-to-many class="KuaJing.Security.Domain.Role,KuaJing.Security" column="RoleId" />
    </set>
    
    <many-to-one name="Membership" column="MembershipId" foreign-key="fk_MembershipUser_Membership" class="KuaJing.Memberships.Domain.Membership,KuaJing.Memberships" cascade="all"/>
    <property name="CreatedTime" access="field.camelcase" />
    <property name="CreatedUserName" access="field.camelcase" />
    <property name="ModifiedTime" access="field.camelcase" />
    <property name="ModifiedUserName" access="field.camelcase" />
    <property name="AccessedTime" access="field.camelcase" />
    <property name="AccessedUserName" access="field.camelcase" />
    <property name="Memo" />
    <property name="IsInvalid" />
  </class>
</hibernate-mapping>
